package com.guanyou.lock;

/**
 * @author zhangwei
 * @date 2018/4/30
 */
public class LockThread2 extends Thread {

    private IDLock iDLock;

    public LockThread2(IDLock idLock, int idx) {
        super("LockThread-" + idx);
        this.iDLock = idLock;
    }

    @Override
    public void run() {

        try {
            iDLock.lock(1L, 2L, 3L);
            Thread.sleep(5000L);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }catch (Exception e) {
            e.printStackTrace();
        } finally {
            iDLock.unlockAll();
        }


    }

}
